home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 14
/
Mac Magazin and MacEasy Magazine CD - Issue 14.iso
/
Wissenschaft & Technik
/
MacGzip 1.0b0
/
Mac
/
Internet Config
/
ICAPI.h
next >
Wrap
Text File
|
1995-04-23
|
12KB
|
257 lines
/*
IMPORTANT NOTES ABOUT THE C CONVERSION
--------------------------------------
o Pascal "var" parameters are converted from "var x : y" to "y *x". This
means that when you see the parameter "y *x" you should be aware that
you *cannot pass in nil*. In future this restriction may be eased,
especially for the attr parameter to ICGetPref. Parameters where nil
is legal are declared using the explicit pointer type, ie "yPtr x".
o Strings are *Pascal* strings. This means that they must be word aligned.
MPW and Think C do this automatically. The last time I check, Metrowerks
C does not. If it still doesn't, then IMHO it's a bug in their compiler
and you should report it to them.
o The canonical Internet Config interface is defined in Pascal. These
headers have not been thoroughly tested. If there is a conflict between
these headers and the Pascal interfaces, the Pascal should take precedence.
*/
/* ///////////////////////////////////////////////////////////////////////////////// */
#ifndef __ICAPI__
#define __ICAPI__
#ifndef __TYPES__
#include <Types.h>
#endif
#ifndef __FILES__
#include <Files.h>
#endif
#ifndef __ICTYPES__
#include <ICTypes.h>
#endif
#ifndef __ICKEYS__
#include <ICKeys.h>
#endif
/* ///////////////////////////////////////////////////////////////////////////////// */
#ifdef __cplusplus
extern "C" {
#endif
pascal ICError ICStart(ICInstance *inst, OSType creator);
/* call at application initialisation */
pascal ICError ICStop(ICInstance inst);
/* call at application termination */
pascal ICError ICFindConfigFile(ICInstance inst, short count, ICDirSpecArrayPtr folders);
/* count is the number of ICDirSpecs that are valid in folders */
/* searches the specified folders first, then backs out to preferences folder */
/* don't you worry about how it finds the file (; */
/* you can pass nil to folders if count is 0 */
pascal ICError ICFindUserConfigFile(ICInstance inst, ICDirSpec *where);
/* requires IC 1.1 */
/* similar to ICFindConfigFile except */
/* For use with double clickable preference files, this searches only the where directory */
pascal ICError ICSpecifyConfigFile(ICInstance inst, FSSpec *config);
/* for use *only* by Internet Configuration application */
pascal ICError ICGetSeed(ICInstance inst, long *seed);
/* returns current seed for prefs file */
/* this seed changes every time a preference is modified */
/* poll this to detect preference changes by other applications */
pascal ICError ICGetPerm(ICInstance inst, ICPerm *perm);
/* returns the permissions currently associated with this file */
/* mainly used by overriding components, applications normally */
/* know what permissions they have */
pascal ICError ICBegin(ICInstance inst, ICPerm perm);
/* start reading/writing the preferences */
/* must be balanaced by a ICEnd */
/* do not call WaitNextEvent between this pair */
/* specify either icReadOnlyPerm or icReadWritePerm */
/* note that this may open resource files and leave them open until ICEnd */
pascal ICError ICGetPref(ICInstance inst, ConstStr255Param key, ICAttr *attr, Ptr buf, long *size);
/* this routine may be called without a ICBegin/ICEnd pair, in which case */
/* it implicitly calls ICBegin(inst, icReadOnlyPerm */
/* given a key string, returns the attributes and the (optionally) the data for a preference */
/* key must not be the empty string */
/* if buf is nil then no data fetched and incoming size is ignored*/
/* size must be non-negative, is size of allocated space for data at buf */
/* attr and size and always set on return */
/* size is actual size of data (if key present); */
/* attr is pref attributes */
/* if icTruncatedErr then everything is valid, except you lost some data, size is size of real data*/
/* on other errors, attr is ICattr_no_change and size is 0 */
pascal ICError ICSetPref(ICInstance inst, ConstStr255Param key, ICAttr attr, Ptr buf, long size);
/* this routine may be called without a ICBegin/ICEnd pair, in which case */
/* it implicitly calls ICBegin(inst, icReadWritePerm */
/* given a key string, sets the attributes and the data for a preference (either is optional); */
/* key must not be the empty string */
/* if buf is nil then no data stored and size is ignored, used for setting attr */
/* size must be non-negative, is size of the data at buf to store */
/* icPermErr if ICBegin was given icReadOnlyPerm */
/* icPermErr if current attr is locked, new attr is locked and buf <> nil */
pascal ICError ICGetPrefHandle(ICInstance inst, ConstStr255Param key, ICAttr *attr, Handle *prefh);
/* same as ICGetPref except that it returns the result in a newly created handle */
/* attr must not be nil */
/* prefh is set to a newly created handle */
pascal ICError ICSetPrefHandle(ICInstance inst, ConstStr255Param key, ICAttr attr, Handle prefh);
/* same as ICSetPref except that it sets the preference based on a handle */
/* prefh must not be nil */
pascal ICError ICCountPref(ICInstance inst, long *count);
/* count total number of preferences */
/* if error then count is 0 */
pascal ICError ICGetIndPref(ICInstance inst, long n, Str255 key);
/* return the key of the Nth preference */
/* n must be positive */
/* icPrefNotFoundErr if n is beyond the last preference */
pascal ICError ICDeletePref(ICInstance inst, ConstStr255Param key);
/* delete the preference specified by key */
/* key must not be the empty string */
/* preference specified by key must be present */
/* icPrefNotFoundErr if it isn't */
pascal ICError ICEnd(ICInstance inst);
/* stop reading/writing the preferences */
pascal ICError ICDefaultFileName(ICInstance inst, Str63 name);
/* return the default file name */
/* the component calls this routine to set up the default internet configuration file name*/
/* this allows this operation to be intercepted by a component that has captured us */
/* it currently gets it from the component resource file */
/* the glue version is hardwired */
pascal ICError ICGetComponentInstance(ICInstance inst, Ptr *component_inst);
/* returns noErr and the component instance that we're talking to, if we're using the component */
/* returns an error and nil if we're doing it with glue */
pascal ICError ICEditPreferences(ICInstance inst, ConstStr255Param key);
/* requires IC 1.1 */
/* this routine may be called without a ICBegin/ICEnd pair */
/* open the IC application and edits the preference */
/* you must have found a config file before calling this */
/* if key is empty then it just opens the application with the found config file */
/* otherwise it displays the preference with the specified key */
/* may have an implementation that is radically different in the future */
pascal ICError ICParseURL(ICInstance inst, ConstStr255Param hint, Ptr data, long len, long *selStart, long *selEnd, Handle url);
/* requires IC 1.1 */
/* this routine may be called without a ICBegin/ICEnd pair */
/* parses a URL out of a chunk of text and returns it in a canonical form */
/* hint is an indication of how you want slack URLs to be parsed */
/* data points to the beginning of the text */
/* len is the length of the text */
/* selStart is the start of the current selection */
/* selEnd is the end of the current selection */
/* both of these are interpreted as per TextEdit */
/* both of these are adjusted to indicate the bounds of the text that was interpreted as a URL */
/* the URL is copied into the url handle, which is resized to accomodate the URL */
pascal ICError ICLaunchURL(ICInstance inst, ConstStr255Param hint, Ptr data, long len, long *selStart, long *selEnd);
/* requires IC 1.1 */
/* this routine may be called without a ICBegin/ICEnd pair */
/* identical to ParseURL but it launches the appropriate application (as specified in the 'Helper•' preference */
/* and sends it a GURL AppleEvent */
/* your code must be running in the context of a high level event aware application for this to work */
/* ----- Mappings Routines ----- */
/* Routines for interrogating mappings database */
/* All of these routines require IC 1.1 */
/* High Level Routines */
/* you do not need to call begin/end around any of these high level routines */
/* but if you're going to call them repeatedly, it will help */
pascal ICError ICMapFilename(ICInstance inst, ConstStr255Param filename, ICMapEntry *entry);
/* high level interface to the mappings database */
/* takes a filename and returns the incoming entry associated with that file's extension */
/* or errors with icPrefNotFoundErr */
pascal ICError ICMapTypeCreator(ICInstance inst, OSType fType, OSType fCreator, ConstStr255Param filename, ICMapEntry *entry);
/* high level interface to the mappings database */
/* takes a filename and returns the outgoing entry associated with that type, creator and filename */
/* or errors with icPrefNotFoundErr */
/* Mid Level Routines */
/* you do not need to call begin/end around any of these mid level routines */
pascal ICError ICMapEntriesFilename(ICInstance inst, Handle entries, ConstStr255Param filename, ICMapEntry *entry);
/* mid level interface to the mappings database */
/* entries must be a valid IC mappings database handle */
/* takes a filename and returns the incoming entry associated with that file's extension */
/* or errors with icPrefNotFoundErr */
pascal ICError ICMapEntriesTypeCreator(ICInstance inst, Handle entries, OSType fType, OSType fCreator, ConstStr255Param filename, ICMapEntry *entry);
/* mid level interface to the mappings database */
/* entries must be a valid IC mappings database handle */
/* takes a filename and returns the outgoing entry associated with that type, creator and filename */
/* or errors with icPrefNotFoundErr */
/* Low Level Routines */
/* you do not need to call begin/end around any of these low level routines */
pascal ICError ICCountMapEntries(ICInstance inst, Handle entries, long *count);
/* entries must be a valid IC mappings database handle */
/* count the number of entries in the Mappings database */
pascal ICError ICGetIndMapEntry(ICInstance inst, Handle entries, long ndx, long *pos, ICMapEntry *entry);
/* entries must be a valid IC mappings database handle */
/* return the ndx'th entry in the mappings database */
/* ndx must be from 1 to CountMapEntries */
/* pos is ignored on input and comes back as the position of the entry in the database */
/* entry is ignored on input and comes back as the database entry at the ndx position */
pascal ICError ICGetMapEntry(ICInstance inst, Handle entries, long pos, ICMapEntry *entry);
/* entries must be a valid IC mappings database handle */
/* return the entry at position pos */
/* pos should be a valid entry start position */
/* set pos to 0 for the first entry */
/* set pos to pos + entry.total_size for subsequent entries */
/* entry is ignored on input and comes back as the database entry at position pos */
pascal ICError ICSetMapEntry(ICInstance inst, Handle entries, long pos, ICMapEntry *entry);
/* entries must be a valid IC mappings database handle */
/* set the entry at position pos */
/* pos should be a valid entry start position */
/* any user data at the end of the entry is preserved */
/* entry is not modified, it's a var parameter simply to preserve stack space */
pascal ICError ICDeleteMapEntry(ICInstance inst, Handle entries, long pos);
/* entries must be a valid IC mappings database handle */
/* delete the entry at position pos */
/* pos should be a valid entry start position */
/* also deletes the user data associated with the entry */
pascal ICError ICAddMapEntry(ICInstance inst, Handle entries, ICMapEntry *entry);
/* entries must be a valid IC mappings database handle */
/* add entry to the mappings database */
/* entry is not modified, it's a var parameter simply to preserve stack space */
#ifdef __cplusplus
}
#endif __cplusplus
#endif